/*
 * TableModel.java
 * Created on 11 de noviembre de 2007, 12:00 PM
 */
package co.edu.uniandes.intercon.client.model;

import javax.swing.table.AbstractTableModel;

import co.edu.uniandes.intercon.core.model.ApplicationDto;
import co.edu.uniandes.intercon.core.model.BaseDto;

/**
 * <code>TableModel</code> used to represent the <code>Room</code> structure 
 * in a tabular way
 * 
 * @author Fabian Gutierrez [fagossa@gmail.com]
 */
public class LocalApplicationTableModel extends BaseP2PApplicationTableModel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -6074987272790065853L;
	
	private String[] titles = {"Nombre", "Tipo", "Ruta"};
	
	 /**
     * @see AbstractTableModel#getColumnName
     */
    @Override
    public String getColumnName(int column) {
        return titles[column];
    }
	
	/**
     * @see AbstractTableModel#getColumnCount
     */
    public int getColumnCount() {
        return titles.length;
    }
    
    /**
     * @see BaseP2PApplicationTableModel#getValueAt(int, ApplicationDto)
     */
    public Object getValueAt(int columnIndex, BaseDto dtoBase) {
    	ApplicationDto dto = (ApplicationDto)dtoBase;
    	String resultado = "";
		if(columnIndex==0) {
			resultado = dto.getName();
		}
		if(columnIndex==1) {
			resultado = dto.getType().name();
		}
		if(columnIndex==2) {
			resultado = dto.getFilePath()==null?"":dto.getFilePath();
		}
		
		return resultado;
    }    

	
}
